package com.mofum.scope.service.impl;

import com.mofum.scope.annotation.service.ColumnScope;
import com.mofum.scope.annotation.service.TableScope;

import com.mofum.scope.dto.UserDto;
import com.mofum.scope.entity.Page;
import com.mofum.scope.entity.User;
import com.mofum.scope.mapper.UserMapper;
import com.mofum.scope.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 用户业务
 *
 * @author developer@omuao.com
 * @since 2019-03-28
 **/
@Service
@TableScope(columns = {
        /**
         * @see com.mofum.scope.controller.ScopeController 中的extractorScopes()方法
         */
        @ColumnScope(type = "ScopeOne", value = "scope_one") //配置列type 是类型，scope_one是表中的列
})
public class UserServiceImpl implements IUserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public void initTable() {
        userMapper.createTable();
    }

    @Override
    public void addUser(User user) {
        userMapper.insertUser(user);
    }

    @Override
    public List<User> queryUser(UserDto user, Page page) {
        return userMapper.queryUser(user,page);
    }

    @Override
    public int delete(UserDto userDto) {
        return 0;
    }
}
